package ee.videorentalstore.inventories;


public class Film 
{
	private static int nextFilmUID = 1;
	private int filmID = 0;
	private String name;
	private FilmType type;
	
	
	public Film(String name, FilmType type)
	{
		setFilmUID();
		this.name = name;
		this.type = type;
	}


	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + filmID;
		return result;
	}

	
	@Override
	public boolean equals(Object object) 
	{
		if (this == object)
			return true;
		if (object == null)
			return false;
		if (getClass() != object.getClass())
			return false;
		Film other = (Film) object;
		if (filmID != other.filmID)
			return false;
		return true;
	}

	
	private void setFilmUID()
	{
		filmID = nextFilmUID;
		nextFilmUID++;
	}
	
	
	public int getFilmID()
	{
		return filmID;
	}
	
	public String getName() 
	{
		return name;
	}
	public void setName(String name) 
	{
		this.name = name;
	}
	public FilmType getType() 
	{
		return type;
	}
	public void setType(FilmType type) 
	{
		this.type = type;
	}
	
	@Override
	public String toString()
	{
		return filmID + " Name: " + name + " (" + type.toString() + ")";
	}
}
